<template>
	<view>
		
			<view class="new" 
			v-for=" i in list " 
			:key="i.id" 
			@click="turn(i.id)">
				<image src="i.img_url" ></image>
				<view class="detail">
					<view class="title">
						{{i.title}}
					</view>
					<view class="info">
						<text>发表时间：{{i.add_time | foramate }}</text>
						<text>浏览：{{i.click}}</text>
					</view>
				</view>
			</view>
		
		
	</view>
</template>

<script>
	
	export default {
		name:"newsList",
		filters:{
			foramate(date){
				const fdate = new Date(date)
				const y = fdate.getFullYear()
				const m = fdate.getMonth().toString().padStart(2,0)
				const d = fdate.getDay().toString().padStart(2,0)
				return y+'-'+m+'-'+d
			}
		},
		data() {
			return {
				
			};
		},
		props:['list'],
		methods:{
			turn(id){
				this.$emit("turnto",id)
			}
		}
		
	}
</script>

<style lang="scss">

	.new{
		display: flex;
		padding: 10rpx 20rpx;
		border-bottom: 1px solid $index_color;
		image{
			min-width: 200rpx;
			max-width: 200rpx;
			height: 150rpx;
		}
		.detail{
			margin-left: 15rpx;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			.title{
				font-size: 30rpx;
			}
			.info{
				font-size: 24rpx;
				text:nth-child(2){
					margin-left: 30rpx;
				}
			}
		}
	}

</style>